gtkx: Warn if we include gtkx.h during GTK compilation
authorBenjamin Otte <otte@redhat.com>
Sat, 12 Jul 2014 03:29:54 +0000 (05:29 +0200)
committerBenjamin Otte <otte@redhat.com>
Sat, 12 Jul 2014 05:13:28 +0000 (07:13 +0200)
gtk/Makefile.am
gtk/gtktestutils.c
gtk/gtkx.h

index f9747235502f4306b3b2b55191bf116ef326b519..531b31550468fc5ed13441c0c97bdcfc74e8fe83 100644 (file)
@@ -1450,7 +1450,7 @@ gtkprivatetypebuiltins.c: $(gtk_private_type_h_sources)  gtkprivatetypebuiltins.
 
 
 gtktypefuncs.c: stamp-gtktypebuiltins.h stamp-gtkprivatetypebuiltins.h $(top_srcdir)/gtk/*.h $(top_srcdir)/gtk/a11y/*.h $(top_srcdir)/gtk/deprecated/*.h $(top_srcdir)/gdk/*.h Makefile
-       $(AM_V_GEN) echo '#include <gtk/gtkx.h>' > xgen-gtfsrc.c && \
+       $(AM_V_GEN) (echo '#undef GTK_COMPILATION' && echo '#include <gtk/gtkx.h>') > xgen-gtfsrc.c && \
          echo 'G_GNUC_BEGIN_IGNORE_DEPRECATIONS' > xgen-gtf && \
          ${CPP} $(DEFS) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) xgen-gtfsrc.c | \
          $(GREP) -o '\bg[td]k_[a-zA-Z0-9_]*_get_type\b' | \
index fa0067802deec932c23bba98f579922ae6c81718..b96a828f1bf985f9e6aadc2e534a3f03bb6072aa 100644 (file)
@@ -19,7 +19,6 @@
 
 #include "config.h"
 
-#include <gtk/gtkx.h>
 #include "gtkspinbutton.h"
 #include "gtkmain.h"
 #include "gtkbox.h"
 #include <string.h>
 #include <math.h>
 
+/* This is a hack.
+ * We want to include the same headers as gtktypefuncs.c but we are not
+ * allowed to include gtkx.h directly during GTK compilation.
+ * So....
+ */
+#undef GTK_COMPILATION
+#include <gtk/gtkx.h>
+#define GTK_COMPILATION
 
 /**
  * SECTION:gtktesting
index 10f3dfaedc5e78776b04c6a42cde56dbab140d3a..e5d25318238f50fd4fb24d49798dc143be4346b5 100644 (file)
 #ifndef __GTK_X_H__
 #define __GTK_X_H__
 
+#if defined (GTK_COMPILATION)
+#error "<gtk/gtkx.h> must not be included by GTK+ headers."
+#endif
+
 #define __GTKX_H_INSIDE__
 
 #include <gtk/gtk.h>